package com.freemypay.test.并发.共享受限资源.原子类;

import java.util.concurrent.atomic.AtomicInteger;

import com.freemypay.test.并发.共享受限资源.不正确的访问资源.EvenChecker;
import com.freemypay.test.并发.共享受限资源.不正确的访问资源.IntGenerator;

public class AtomicEvenGenerator extends IntGenerator {
	private AtomicInteger currentEventValue = new AtomicInteger(0);
	
	@Override
	public int next() {
		return currentEventValue.addAndGet(2);
	}
	
	public static void main(String[] args) {
		EvenChecker.test(new AtomicEvenGenerator());
	}

}
